package week_home_work02;

import java.util.Scanner;

/**
 * @author zdl
 * @date 2024/11/23
 */
public class Demo50 {
    public static void main(String[] args) {
        //实现一个程序，判断一个正整数是否为 Armstrong 数。        (1^3 + 5^3 + 3^3 = 153)
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个整数:");
        int num = sc.nextInt();
        int sum = 0;
        int yunNum = num;
        while (num != 0) {
            int lastNum = num % 10;
            sum = sum + lastNum * lastNum * lastNum;
            num /= 10;
        }
        if (yunNum == sum) {
            System.out.println(yunNum + "是一个Armstrong 数");
        } else {
            System.out.println(yunNum + "不是一个Armstrong 数");
        }
    }
}
